# encoding: utf-8


"""

@author: tongzhenguo

@time: 2021/5/14 下午8:54

@desc:

归类技术分析中的买卖信号
"""
from collect_baostock_data import StockBase
from ta import MyTalib


class BuySignal(object):
    def __init__(self):
        super().__init__()
        self.mt = MyTalib()
        self.stock_base = StockBase()
        pass

    def golden_cross(self, data):
        """月均线多头排列、周均线寻找金叉"""
        # data["ma"]
        pass

    def kdj_0_buy(self, df):
        """kdj的j值小于等于0超卖买入"""
        return df["J"].tail(1).values[0] <= 0

    def ad_increase(self, df):
        """ad上升，产出买入机会"""
        values = df["ad"].tail(2).values
        t_2_ad = values[0]
        t_1_ad = values[1]
        return t_1_ad > t_2_ad
